package com.whitesalt.inputfix;

import org.bukkit.Bukkit;
import org.bukkit.command.ConsoleCommandSender;

/**
 * @ White_Salt
 * 创建于 2017/10/14
 * powered by: IntelliJ IDEA
 */
public class AsynCommand
{
    private static InputFix plugin;

    public static void setPlugin(InputFix aPlugin)
    {
        plugin = aPlugin;
    }
    public static void dispatch(Runnable runnable)
    {
        Bukkit.getScheduler().runTask(plugin, runnable);
    }
    public static void dispatchCommand(String command)
    {
        dispatch(new Runnable()
        {
            public void run()
            {
                Bukkit.dispatchCommand(AsynCommand.getConsoleSender(), command);
            }
        });
    }
    public static ConsoleCommandSender getConsoleSender()
    {
        return Bukkit.getServer().getConsoleSender();
    }
}
